<?php
/* @var $this RankController */
/* @var $model ActUserRanking */
/* @var $form CActiveForm */
?>

<div class="wide form">

    <?php $form=$this->beginWidget('bootstrap.widgets.BsActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>

                    <?php echo $form->textFieldControlGroup($model,'user_id'); ?>

                    <div class="form-group">
					<label class="control-label" for="LogRecharge_amount">创建时间</label>
					<div>
					<button class="btn btn-default" id="daterangepicker2">
                        <i class="icon-calendar"></i> 
                        <span><?php echo date('Y-m-d',time()).' - '.date('Y-m-d',time());?></span> <b class="caret"></b>
                    </button>
					<input id="LogRecharge_create_time" class="form-control" type="hidden" value="<?php echo date('Y-m-d',time()).' - '.date('Y-m-d',time());?>" placeholder="创建时间" name="ActUserRanking[create_time]">
					</div>
					</div>

        <div class="form-actions">
        <?php echo BSHtml::submitButton('Search',  array('color' => BSHtml::BUTTON_COLOR_PRIMARY,));?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- search-form -->
<?php 
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(Yii::app()->baseUrl.'/themes/avant/assets/js/form-daterangepicker/daterangepicker.min.js');
$cs->registerScriptFile(Yii::app()->baseUrl.'/themes/avant/assets/js/form-daterangepicker/moment.min.js');
?>
<script>
$('#daterangepicker2').daterangepicker(
        {
        	ranges: {
                '今天': [moment(), moment()],
                '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
                '最近7天': [moment().subtract('days', 6), moment()],
                '最近30天': [moment().subtract('days', 29), moment()],
                '这个月': [moment().startOf('month'), moment().endOf('month')],
                '最近一个月': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
             },
          opens: 'left',
          startDate: moment().subtract('days', 29),
          endDate: moment()
        },
        function(start, end) {
            $('#daterangepicker2 span').html(start.format('YYYY-MM-D') + ' - ' + end.format('YYYY-MM-D'));
            $('#LogRecharge_create_time').val(start.format('YYYY-MM-D') + ' - ' + end.format('YYYY-MM-D'));
        }
    );
</script>